#ifndef __CAN_H__
#define __CAN_H__

#ifdef __cplusplus
extern "C" {
#endif

#include "stdio.h"
#include "at32f403a_407.h"
#include "at32f403a_407_board.h"



//标志位定义
#define Flag_CAN_Clear 0x00
#define Flag_CAN1 0x01
#define Flag_CAN2 0x02
#define Flag_CAN1_ID1 0x01
#define Flag_CAN1_ID2 0x02
#define Flag_CAN1_ID3 0x04
#define Flag_CAN2_ID1 0x10
#define Flag_CAN2_ID2 0x20
#define Flag_CAN2_ID3 0x40


//CAN的ID定义
#define Motor1_CAN_ID 0x64
#define Motor2_CAN_ID 0x65
#define Motor3_CAN_ID 0x66
#define abad 1
#define hip 2
#define knee 3


#define Flag_Motor_Error 0
#define Flag_Motor_Start 0x00000001
#define Flag_Motor_Stop 0x00000002
#define Flag_Motor_SetZero 0x00000004
#define Flag_Motor_Control 0x00000008
#define Flag_Motor_Mode_Position 0x00000010
#define Flag_Motor_Mode_Velocity 0x00000020
#define Flag_Motor_Mode_Torque 0x00000040
void CAN_Init(void);
void CAN_Send(can_type *CAN, uint16_t ID, uint8_t *CAN_DATA);
extern  uint8_t Flag_CAN_Rx;
extern uint8_t CAN1_Rx_Data[24];
extern uint8_t CAN2_Rx_Data[24];

#ifdef __cplusplus
}
#endif

#endif